﻿namespace ChengNet.StrongCaml.Node
{
    /// <summary>
    /// A filter condition for a CAML query. Either a <see cref="Node.Comparison"/> or a <see cref="Node.LogicalJoin"/>.
    /// </summary>
    public abstract class Condition : CamlNode
    {
        /// <summary>Constructor with one field</summary>
        protected Condition(FieldRef fieldRef) : base(fieldRef) { }

        /// <summary>Constructor for ValueType.Boolean values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.Boolean> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.Integer values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.Integer> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.Lookup values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.Lookup> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.Text values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.Text> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.Note values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.Note> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.DateTime values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.DateTime> value) : base(fieldRef, value) { }
        /// <summary>Constructor for ValueType.User values</summary>
        protected Condition(FieldRef fieldRef, Value<ValueType.User> value) : base(fieldRef, value) { }

        /// <summary>Constructor for nesting two child conditions</summary>
        protected Condition(Condition left, Condition right) : base(left, right) { }
    }
}
